﻿#region Includes

using System;
using System.Collections.Generic;

#endregion

namespace ArtheaEngine.Model
{
    public abstract partial class Object : IEntity, IDisposable, ICloneable
    {
        public Object()
        {
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        public Object Clone()
        {
            return MemberwiseClone() as Object;
        }

        public WearLocation WearLocation
        {
            get;
            set;
        }

        public virtual string ToString(string format, IFormatProvider formatProvider)
        {
            if (string.IsNullOrEmpty(format)) format = "G";

            switch (format.ToUpper())
            {
                case "G":
                case "N":
                    return ShortDescr.ToString(formatProvider);
                case "L":
                    return Description.ToString(formatProvider);
                default:
                    throw new FormatException("Invalid format for object");
            }
        }

        #region IDisposable Members

        public virtual void Dispose()
        {
            
        }

        #endregion

    }

    public enum WearLocation
    {
        None,
        Head,
        Neck,
        Shoulders,
        Arms,
        Hands,
        WristRight,
        WristLeft,
        Torso,
        Waist,
        Legs,
        Feet,
        Wielded,
        Holding,
        Back
    }

    public partial class WearLocationWrapper
    {
        public WearLocation EnumValue
        {
            get { return (WearLocation)Value; }
            set { Value = (int)value; }
        }

        public static implicit operator WearLocation(WearLocationWrapper wrapper)
        {
            if (wrapper == null) return default(WearLocation);

            return wrapper.EnumValue;
        }

        public static implicit operator WearLocationWrapper(WearLocation loc)
        {
            return new WearLocationWrapper { EnumValue = loc };
        
        }
    }

    public partial class WeaponClassWrapper
    {
        public WeaponClass EnumValue
        {
            get { return (WeaponClass)Value; }
            set { Value = (int)value; }
        }

        public static implicit operator WeaponClass(WeaponClassWrapper wrapper)
        {
            if (wrapper == null) return default(WeaponClass);

            return wrapper.EnumValue;
        }

        public static implicit operator WeaponClassWrapper(WeaponClass type)
        {
            return new WeaponClassWrapper { EnumValue = type };
        }
    }

    public enum WeaponClass
    {
        Exotic,
        Sword,
        Dagger,
        Spear,
        Mace,
        Axe,
        Flail,
        Whip,
        Polearm
    }
}